package com.atguigu.yygh.hosp.controller;

import java.util.List;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.atguigu.yygh.common.result.Result;
import com.atguigu.yygh.hosp.service.DepartmentService;
import com.atguigu.yygh.vo.hosp.DepartmentVo;

import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/admin/hosp/department")
@CrossOrigin  //允许跨域访问
public class DepartController {

	@Autowired
	private DepartmentService departmentService;
	
	//查询医院所有科室列表
	@ApiOperation(value = "查询医院所有科室列表")
	@GetMapping("/getDepartmentList/{hostcode}")
	public Result getDepartmentList(@PathVariable(value = "hostcode") String hostcode){
		List<DepartmentVo> deptList = departmentService.findDeptTree(hostcode);
		return Result.ok(deptList);
	}
}
